<?php
namespace app\admin\model;

use think\Model;
use \think\Db;
use \think\Session;
class Login extends Model
{
	public function login($a,$b){

				$admin=Db::name('sadmin')->where('s_name',$a)->find();
					
				if($admin){
						if(md5($b)==$admin['s_password']){
							Session::set('login_id',$admin['s_id']);
							Session::set('login_name',$a);
							//$this->redirect("video/index");
							return 3;
						}
						else
						{
							//echo "<script>alert('密码错误');</script>";
							return 2;
						}
				}
				else{
						//echo "<script>alert('用户不存在');</script>";
					return 1;
				}
	}
}